export const requestAnimFrame = window.requestAnimationFrame	||
	window.webkitRequestAnimationFrame	||
	window.mozRequestAnimationFrame		||
	window.oRequestAnimationFrame		||
	window.msRequestAnimationFrame		||
	function (callback) { window.setTimeout(callback, 1000 / 60); };

export const  prefixEvent=function(t){if(t){var e=document.createElement("div"),n={Webkit:"webkit",Moz:"",O:"o"};for(var i in n)if(void 0!=e.style[i+"TransitionProperty"])return n[i]+String.fromCharCode(t[0].charCodeAt()-32)+t.slice(1)}}

export const prefixStyle=function(style){
    var el = document.createElement('div')
    var vendors = 'webkitT,t,,MozT,msT,OT'.split(','),prefix;
    var first=style.slice(0,1);
    style=style.slice(1);
    for(var i in vendors){
        if( vendors[i].slice(-1).charCodeAt()>=97){
            vendors[i]=vendors[i].replace(/\w$/,first)
        }else{
            vendors[i]=vendors[i].replace(/\w$/,first.toUpperCase())
        }
    }
    for ( prefix in vendors) {
        if(el.style[vendors[prefix]+style]!=undefined){
            return vendors[prefix]+style
        }
    }
}

export const TransitionEnd=prefixEvent("transitionEnd")
